<?php    
header('Content-type: application/xls');
header("Content-Disposition:attachment;filename=danhsachkenh.xls");

?>
<?php if (!empty($z1kenhnvs)){?>
	 <table >
            <tr><td colspan="3" align="center" style="font-weight: bold; ">
<? echo $tendv ['Zdv'] ['tendvcha'];?>
            </td>
            <td colspan="3" align="center" style="font-weight: bold; ">CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM</td>
            </tr>
            <tr>
            <td colspan="3" align="center" style="font-weight: bold; ">
             <?php
echo $tendv['Zdv'] ['tendv'];
?>
            
             </td>
                <td colspan="3" align="center" style="font-weight: bold; ">Độc lập- tự do- hạnh phúc</td>
            </tr>
            <tr>
            <td colspan="6" align="center" style="font-weight: bold; font-size: large;">
          Danh sách các kênh <?php echo $tenloai['Loaikenh'] ['loaikenh']?> 
            </td>
            </tr>
             <tr>
            <td colspan="6" align="center" style="font-weight: bold; ">
          <?php if($nhanvien_id != 0) echo '<strong>Nhân viên: '.$n ['Nhanvien']  ['manv'].'- '.
                $n ['Nhanvien'] ['tennv'].'</strong>';?>
            </td>
            </tr>
    </table>
<table cellpadding="0" cellspacing="0" border="1">
	<tr>
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('STT');?></th>
            <th style="background: #d5d5d5; font-weight:bold"><?php echo ('Đơn vị');?></th>
			<th style="background: #d5d5d5; font-weight:bold"><?php echo 'Nhân viên';?></th>
            <th style="background: #d5d5d5; font-weight:bold"><?php echo ('Loại kênh');?></th>
			
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('Mã kênh');?></th>
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('Tên kênh');?></th>
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('Địa chỉ');?></th>
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('SĐT');?></th>
			
			<th style="background: #d5d5d5; font-weight:bold"><?php echo ('Ngày nhận kênh');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($z1kenhnvs as $z1kenhnv):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
         <td>
			<?php echo $z1kenhnv['Donvi']['tendonvi']; ?>
		</td>
		<td>
			<?php echo $z1kenhnv['Nhanvien']['name']; ?>
		</td>
		<td>
			<?php echo $z1kenhnv['Loaikenh']['loaikenh']; ?>
		</td>
		<td><?php echo $z1kenhnv['Z1kenhnv']['makenh']; ?>&nbsp;</td>
		<td><?php echo $z1kenhnv['Z1kenhnv']['tenkenh']; ?>&nbsp;</td>
		<td><?php echo $z1kenhnv['Z1kenhnv']['diachi']; ?>&nbsp;</td>
		<td><?php echo $z1kenhnv['Z1kenhnv']['sdt']; ?>&nbsp;</td>
       
		<td><?php echo date('d-m-Y',strtotime($z1kenhnv['Z1kenhnv']['ngaybd_hd'])); ?>&nbsp;</td>
		
	</tr>
<?php endforeach; }?>
	</table>
	